package com.todo.user.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/4/7 21:15
 * @description
 */
@Getter
@AllArgsConstructor
public enum FriendTypeEnum {
    FOLLOW(1, "FOLLOW", "关注"),
    FOLLOWED(2, "FOLLOWED", "被关注"),
    FRIENDS(3, "FRIENDS", "好友"),
    BLACKLIST(4, "BLACKLIST", "拉黑"),
    SHIELD(5, "SHIELD", "屏蔽对方"),
    NONE(6, "NONE", "无关联"),
    ;

    private static Map<Integer, FriendTypeEnum> typeMap = Arrays
            .stream(FriendTypeEnum.values())
            .collect(Collectors.toMap(FriendTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static FriendTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
